#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main()
{
	long long int x, n, digit=1;
	scanf("%lld%lld", &x, &n);
	for (; n > 0; n--) 
		digit = digit + x * digit;
	printf("%lld", digit);
	return 0;
}//